package simple

/*
执行用时分布
4ms
击败1.72%
*/
func merge(nums1 []int, m int, nums2 []int, n int) {
	l, r := 0, 0
	temp := make([]int, 0, len(nums1))
	for l < m && r < n {
		if nums1[l] < nums2[r] {
			temp = append(temp, nums1[l])
			l++
		} else {
			temp = append(temp, nums2[r])
			r++
		}
	}
	temp = append(temp, nums1[l:m]...)
	temp = append(temp, nums2[r:n]...)
	copy(nums1, temp)
}
